# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=kube-hunter
pkgver=703.bc47f08
_pyver=3.13
pkgrel=7
pkgdesc='Hunt for security weaknesses in Kubernetes clusters.'
arch=('any')
groups=('blackarch' 'blackarch-scanner')
url='https://github.com/aquasecurity/kube-hunter'
license=('Apache')
depends=('python' 'python-netaddr' 'python-netifaces' 'python-scapy'
         'python-requests' 'python-prettytable' 'python-urllib3'
         'python-ruamel-yaml' 'python-future' 'python-packaging'
         'python-pluggy' 'python-kubernetes')
makedepends=('git' 'python-setuptools' 'python-pip')
source=("git+https://github.com/aquasecurity/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd $pkgname

  python setup.py build
}

package() {
  cd $pkgname

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm -rf "$pkgdir/usr/lib/python$_pyver/site-packages/tests"
}

